<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工作列表</title>
    <script type="text/javascript" src="./js/jquery-3.1.1.js"></script>
    <script type="text/javascript" src="./js/util.js"></script>
    <link rel="stylesheet" type="text/css" href="./css/jobPage.css"/>
</head>
<body>

<div style="background: #333333;height: 35px">
    <a href="#" class="top_button">注册</a>
    <a href="#" class="top_button">登录</a>
</div>
<div class="nav1">
    <img class="logo" src="./drawable/logo.png" alt="logo">
    <h3 id="location" style="font-weight: normal;position: relative;top: 20px;margin-left: 20px">全国站</h3>
    <h1 class="frame-nav">工作列表</h1>
    <div class="clear_float"></div>
</div>
<div style="width: 100%;height: 1px;background: #dddddd;margin-top: 10px"></div>

<div class="content">
</div>
<script>
    getJobList();
    function createJobElement(list) {
        $(list).each(function (index, job) {
            var content = " <div style='width: 100%;height: 20px;'></div>" +
                "<span class='j-name'>" + job.jName + "</span>" +
                "<span class='j-city'>[" + job.address + "]</span>" +
                "<span class='j-time'>" + fomatDate(job.jCreateTime)+"发布" + "</span>" +
                "<div style='height: 8px;'></div>" +
                "<span class='j-wages'>" + job.jWages + "</span>" +
                "<span class='j-title'>" + job.jTitle + "</span>" +
                "<span class='j-company'>" + job.jCompany + "</span>" +
                "<div style='height: 15px;'></div>" +
                "<span class='j-tip'>" + job.jTips + "</span>" +
                "<div style='width: 100%;height: 1px;background: #dddddd;margin-top: 10px'></div>";
            $(".content").append($(content));
        })
    }

    function getJobList() {
        $.ajax({
            type: "POST",
            url: "/home",
            data: JSON.stringify(createJson(1)),
            contentType: "application/json;charset:utf-8",
            dataType: "json",
            success: function (data) {
                loading(true);
                if (data.code == 0) {
                    total = data.total;
                    createJobElement(data.data);
                } else {
                    alert(data.message);
                }
            }, error: function (message) {
                loading(true);
                alert(message);
            }
        })
    }

    function createJson(page) {
        var json = {
            "param": "exceptJop",
            "page": page,
            "condition": sessionStorage.getItem("searching")
        };
        return json;
    }

</script>
</body>
</html>